package com.yidu.controller;

import com.yidu.entity.UserRole;
import com.yidu.entity.Users;
import com.yidu.service.UserRoleService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class UserRoleController {
    @Resource
    UserRoleService userRoleService;
    @RequestMapping("/RoleTable")
    public String RoleTable(){
        return "RoleTable";
    }
    @RequestMapping("/selectUserRole")
    @ResponseBody
    public Map selectUserRole(int page, int limit){
        List<UserRole> userRoleList = userRoleService.selectUserRole(page, limit);
        Map map = new HashMap();
        map.put("code",0);
        map.put("msg",":");
        map.put("count",100);
        map.put("data",userRoleList);
        return map;
    }
    @RequestMapping("/insertUserRole")
    public void insertUserRole(UserRole userRole){
        userRoleService.insertUserRole(userRole);
    }
    @RequestMapping("/updateUserRole")
    public void updateUserRole(UserRole userRole){
        userRoleService.updateUserRole(userRole);
    }
    @RequestMapping("/deleteUserRole")
    public void deleteUserRole(int userRoleId){
        userRoleService.deleteUserRole(userRoleId);
    }
}
